﻿using IMES.Common.Domain.SirModel;
using IMES.Common.Dtos;
using IMES.Common.Infrastructure;
using MediatR;

namespace GlennQuigmire.API.Application.Commands
{
    public class InboundOrderTypeSearchHander : IRequestHandler<InboundOrderTypeSearchCommand, ResultT<InboundOrderType>>
    {

        private readonly IBaseRepositorys<InboundOrderType> baseRepositorys;

        public InboundOrderTypeSearchHander(IBaseRepositorys<InboundOrderType> baseRepositorys)
        {
            this.baseRepositorys = baseRepositorys;
        }


        /// <summary>
        /// 查询入库类型
        /// </summary>
        /// <param name="request">查询入库类型请求对象</param>
        /// <param name="cancellationToken">允许取消异步</param>
        /// <returns>返回入库类型响应对象</returns>
        public async Task<ResultT<InboundOrderType>> Handle(InboundOrderTypeSearchCommand request, CancellationToken cancellationToken)
        {
           var result = new ResultT<InboundOrderType>();

            var list = baseRepositorys.GetAll().ToList();
            result.Data =  list;
            return result;

        }
    }
}
